/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package IsdComponent;

import java.util.ArrayList;

/**
 *
 * @author Shameera
 */
public class Directory {

    private final String dirpath;
    private ArrayList<Directory> subDirectories;
    private ArrayList<String> subFiles;
    private final String name;



    public Directory(String path , String name) {
        this.dirpath= path;
        this.name= name;
        subDirectories=new ArrayList<Directory>();
        subFiles = new ArrayList<String>();
    }
    public Directory( String name) {
        this(null , name);
    }


    public ArrayList<Directory> getChildDirectories() {
        return subDirectories;
    }

    public void addChildDir(Directory child){
        subDirectories.add(child);
    }

    public void addChildFile(String file){
        subFiles.add(file);
    }

    public ArrayList<String> getChildFiles() {
        return subFiles;
    }

    public Directory getLastSubDir(){
        if(subDirectories.size()==0){
            return null;
        }else{
            return subDirectories.get(subDirectories.size()-1);
        }
    }

    public int noOfSubDir(){
        return subDirectories.size();
    }

    public int noOfSubFiles(){
        return subFiles.size();
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }
}
